3.1.5 \(\int (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx\) [5]

Optimal. Leaf size=55 \[ a^2 c x+\frac {a^2 c \tanh ^{-1}(\sin (e+f x))}{2 f}-\frac {c \left (2 a^2+a^2 \sec (e+f x)\right ) \tan (e+f x)}{2 f} \]

[Out]

a^2*c*x+1/2*a^2*c*arctanh(sin(f*x+e))/f-1/2*c*(2*a^2+a^2*sec(f*x+e))*tan(f*x+e)/f

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 24, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.125, Rules used = {3989, 3966, 3855} \begin {gather*} \frac {a^2 c \tanh ^{-1}(\sin (e+f x))}{2 f}-\frac {c \tan (e+f x) \left (a^2 \sec (e+f x)+2 a^2\right )}{2 f}+a^2 c x \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + a*Sec[e + f*x])^2*(c - c*Sec[e + f*x]),x]

[Out]

a^2*c*x + (a^2*c*ArcTanh[Sin[e + f*x]])/(2*f) - (c*(2*a^2 + a^2*Sec[e + f*x])*Tan[e + f*x])/(2*f)

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3966

Int[(cot[(c_.) + (d_.)*(x_)]*(e_.))^(m_)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(-e)*(e*Cot
[c + d*x])^(m - 1)*((a*m + b*(m - 1)*Csc[c + d*x])/(d*m*(m - 1))), x] - Dist[e^2/m, Int[(e*Cot[c + d*x])^(m -
2)*(a*m + b*(m - 1)*Csc[c + d*x]), x], x] /; FreeQ[{a, b, c, d, e}, x] && GtQ[m, 1]

Rule 3989

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.)*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))^(n_.), x_Symbol] :> Di
st[((-a)*c)^m, Int[Cot[e + f*x]^(2*m)*(c + d*Csc[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x]
&& EqQ[b*c + a*d, 0] && EqQ[a^2 - b^2, 0] && IntegerQ[m] && RationalQ[n] &&  !(IntegerQ[n] && GtQ[m - n, 0])

Rubi steps

\begin {align*} \int (a+a \sec (e+f x))^2 (c-c \sec (e+f x)) \, dx &=-\left ((a c) \int (a+a \sec (e+f x)) \tan ^2(e+f x) \, dx\right )\\ &=-\frac {c \left (2 a^2+a^2 \sec (e+f x)\right ) \tan (e+f x)}{2 f}+\frac {1}{2} (a c) \int (2 a+a \sec (e+f x)) \, dx\\ &=a^2 c x-\frac {c \left (2 a^2+a^2 \sec (e+f x)\right ) \tan (e+f x)}{2 f}+\frac {1}{2} \left (a^2 c\right ) \int \sec (e+f x) \, dx\\ &=a^2 c x+\frac {a^2 c \tanh ^{-1}(\sin (e+f x))}{2 f}-\frac {c \left (2 a^2+a^2 \sec (e+f x)\right ) \tan (e+f x)}{2 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.32, size = 72, normalized size = 1.31 \begin {gather*} \frac {a^2 c \sec ^2(e+f x) \left (e+f x+\tanh ^{-1}(\sin (e+f x)) \cos ^2(e+f x)+(e+f x) \cos (2 (e+f x))-\sin (e+f x)-\sin (2 (e+f x))\right )}{2 f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + a*Sec[e + f*x])^2*(c - c*Sec[e + f*x]),x]

[Out]

(a^2*c*Sec[e + f*x]^2*(e + f*x + ArcTanh[Sin[e + f*x]]*Cos[e + f*x]^2 + (e + f*x)*Cos[2*(e + f*x)] - Sin[e + f
*x] - Sin[2*(e + f*x)]))/(2*f)

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 84, normalized size = 1.53

method result size
derivativedivides \(\frac {-a^{2} c \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )-a^{2} c \tan \left (f x +e \right )+a^{2} c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )+a^{2} c \left (f x +e \right )}{f}\) \(84\)
default \(\frac {-a^{2} c \left (\frac {\sec \left (f x +e \right ) \tan \left (f x +e \right )}{2}+\frac {\ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )}{2}\right )-a^{2} c \tan \left (f x +e \right )+a^{2} c \ln \left (\sec \left (f x +e \right )+\tan \left (f x +e \right )\right )+a^{2} c \left (f x +e \right )}{f}\) \(84\)
risch \(a^{2} c x +\frac {i a^{2} c \left ({\mathrm e}^{3 i \left (f x +e \right )}-2 \,{\mathrm e}^{2 i \left (f x +e \right )}-{\mathrm e}^{i \left (f x +e \right )}-2\right )}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}+\frac {a^{2} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}+i\right )}{2 f}-\frac {a^{2} c \ln \left ({\mathrm e}^{i \left (f x +e \right )}-i\right )}{2 f}\) \(108\)
norman \(\frac {a^{2} c x +\frac {a^{2} c \left (\tan ^{3}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{f}+a^{2} c x \left (\tan ^{4}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )-\frac {3 a^{2} c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{f}-2 a^{2} c x \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{\left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )^{2}}-\frac {a^{2} c \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )-1\right )}{2 f}+\frac {a^{2} c \ln \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )+1\right )}{2 f}\) \(139\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*(-a^2*c*(1/2*sec(f*x+e)*tan(f*x+e)+1/2*ln(sec(f*x+e)+tan(f*x+e)))-a^2*c*tan(f*x+e)+a^2*c*ln(sec(f*x+e)+tan
(f*x+e))+a^2*c*(f*x+e))

________________________________________________________________________________________

Maxima [A]
time = 0.28, size = 103, normalized size = 1.87 \begin {gather*} \frac {4 \, {\left (f x + e\right )} a^{2} c + a^{2} c {\left (\frac {2 \, \sin \left (f x + e\right )}{\sin \left (f x + e\right )^{2} - 1} - \log \left (\sin \left (f x + e\right ) + 1\right ) + \log \left (\sin \left (f x + e\right ) - 1\right )\right )} + 4 \, a^{2} c \log \left (\sec \left (f x + e\right ) + \tan \left (f x + e\right )\right ) - 4 \, a^{2} c \tan \left (f x + e\right )}{4 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x, algorithm="maxima")

[Out]

1/4*(4*(f*x + e)*a^2*c + a^2*c*(2*sin(f*x + e)/(sin(f*x + e)^2 - 1) - log(sin(f*x + e) + 1) + log(sin(f*x + e)
 - 1)) + 4*a^2*c*log(sec(f*x + e) + tan(f*x + e)) - 4*a^2*c*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 111 vs. \(2 (54) = 108\).
time = 2.73, size = 111, normalized size = 2.02 \begin {gather*} \frac {4 \, a^{2} c f x \cos \left (f x + e\right )^{2} + a^{2} c \cos \left (f x + e\right )^{2} \log \left (\sin \left (f x + e\right ) + 1\right ) - a^{2} c \cos \left (f x + e\right )^{2} \log \left (-\sin \left (f x + e\right ) + 1\right ) - 2 \, {\left (2 \, a^{2} c \cos \left (f x + e\right ) + a^{2} c\right )} \sin \left (f x + e\right )}{4 \, f \cos \left (f x + e\right )^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x, algorithm="fricas")

[Out]

1/4*(4*a^2*c*f*x*cos(f*x + e)^2 + a^2*c*cos(f*x + e)^2*log(sin(f*x + e) + 1) - a^2*c*cos(f*x + e)^2*log(-sin(f
*x + e) + 1) - 2*(2*a^2*c*cos(f*x + e) + a^2*c)*sin(f*x + e))/(f*cos(f*x + e)^2)

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - a^{2} c \left (\int \left (-1\right )\, dx + \int \left (- \sec {\left (e + f x \right )}\right )\, dx + \int \sec ^{2}{\left (e + f x \right )}\, dx + \int \sec ^{3}{\left (e + f x \right )}\, dx\right ) \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(f*x+e))**2*(c-c*sec(f*x+e)),x)

[Out]

-a**2*c*(Integral(-1, x) + Integral(-sec(e + f*x), x) + Integral(sec(e + f*x)**2, x) + Integral(sec(e + f*x)**
3, x))

________________________________________________________________________________________

Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 103 vs. \(2 (51) = 102\).
time = 0.48, size = 103, normalized size = 1.87 \begin {gather*} \frac {2 \, {\left (f x + e\right )} a^{2} c + a^{2} c \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1 \right |}\right ) - a^{2} c \log \left ({\left | \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1 \right |}\right ) + \frac {2 \, {\left (a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 3 \, a^{2} c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )}^{2}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+a*sec(f*x+e))^2*(c-c*sec(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*(f*x + e)*a^2*c + a^2*c*log(abs(tan(1/2*f*x + 1/2*e) + 1)) - a^2*c*log(abs(tan(1/2*f*x + 1/2*e) - 1)) +
 2*(a^2*c*tan(1/2*f*x + 1/2*e)^3 - 3*a^2*c*tan(1/2*f*x + 1/2*e))/(tan(1/2*f*x + 1/2*e)^2 - 1)^2)/f

________________________________________________________________________________________

Mupad [B]
time = 1.51, size = 91, normalized size = 1.65 \begin {gather*} a^2\,c\,x-\frac {3\,a^2\,c\,\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )-a^2\,c\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^3}{f\,\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4-2\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+1\right )}+\frac {a^2\,c\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )}{f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + a/cos(e + f*x))^2*(c - c/cos(e + f*x)),x)

[Out]

a^2*c*x - (3*a^2*c*tan(e/2 + (f*x)/2) - a^2*c*tan(e/2 + (f*x)/2)^3)/(f*(tan(e/2 + (f*x)/2)^4 - 2*tan(e/2 + (f*
x)/2)^2 + 1)) + (a^2*c*atanh(tan(e/2 + (f*x)/2)))/f

________________________________________________________________________________________